import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index("idx_cat_id", ["catId"], {})
@Index("idx_is_head", ["isHead"], {})
@Index("idx_is_special", ["isSpecial"], {})
@Index("idx_is_recom", ["isRecom"], {})
@Index("idx_is_news", ["isNews"], {})
@Index("idx_brand_id", ["brandId"], {})
@Entity("rrz_goods", { schema: "rrzcms" })
export class RrzGoods {
  @PrimaryGeneratedColumn({
    type: "bigint",
    name: "id",
    comment: "产品id",
    unsigned: true,
  })
  id: string;

  @Column("varchar", { name: "name", comment: "产品名称", length: 255 })
  name: string;

  @Column("varchar", {
    name: "subtitle",
    nullable: true,
    comment: "副标题",
    length: 255,
  })
  subtitle: string | null;

  @Column("varchar", { name: "brief", comment: "商品简介", length: 255 })
  brief: string;

  @Column("mediumint", {
    name: "cat_id",
    nullable: true,
    comment: "产品分类id",
    unsigned: true,
  })
  catId: number | null;

  @Column("int", {
    name: "brand_id",
    nullable: true,
    comment: "产品品牌id",
    unsigned: true,
    default: () => "'0'",
  })
  brandId: number | null;

  @Column("varchar", {
    name: "def_img",
    nullable: true,
    comment: "产品默认图片路径",
    length: 500,
  })
  defImg: string | null;

  @Column("longtext", { name: "imgs", nullable: true, comment: "产品图片集合" })
  imgs: string | null;

  @Column("decimal", {
    name: "price",
    nullable: true,
    comment: "产品价格",
    unsigned: true,
    precision: 10,
    scale: 2,
  })
  price: string | null;

  @Column("decimal", {
    name: "del_price",
    nullable: true,
    comment: "产品划线价格",
    unsigned: true,
    precision: 10,
    scale: 2,
  })
  delPrice: string | null;

  @Column("int", {
    name: "store",
    nullable: true,
    comment: "产品库存",
    unsigned: true,
    default: () => "'0'",
  })
  store: number | null;

  @Column("enum", {
    name: "is_presell",
    nullable: true,
    comment: "是否预售（是否定金付款）",
    enum: ["true", "false"],
    default: () => "'false'",
  })
  isPresell: "true" | "false" | null;

  @Column("decimal", {
    name: "presell_price",
    nullable: true,
    comment: "预售价格（定金）",
    unsigned: true,
    precision: 10,
    scale: 2,
  })
  presellPrice: string | null;

  @Column("varchar", {
    name: "sku_name",
    nullable: true,
    comment: "规格名称",
    length: 500,
  })
  skuName: string | null;

  @Column("longtext", { name: "sku_desc", nullable: true, comment: "产品规格" })
  skuDesc: string | null;

  @Column("longtext", { name: "content", nullable: true, comment: "产品详情" })
  content: string | null;

  @Column("longtext", {
    name: "wap_content",
    nullable: true,
    comment: "手机端详情",
  })
  wapContent: string | null;

  @Column("int", {
    name: "sales",
    nullable: true,
    comment: "产品销量",
    unsigned: true,
    default: () => "'0'",
  })
  sales: number | null;

  @Column("int", {
    name: "addtime",
    nullable: true,
    comment: "创建时间",
    unsigned: true,
    default: () => "'0'",
  })
  addtime: number | null;

  @Column("tinyint", {
    name: "is_head",
    nullable: true,
    comment: "头条（0=否，1=是）",
    unsigned: true,
    default: () => "'0'",
  })
  isHead: number | null;

  @Column("tinyint", {
    name: "is_special",
    nullable: true,
    comment: "特荐（0=否，1=是）",
    unsigned: true,
    default: () => "'0'",
  })
  isSpecial: number | null;

  @Column("tinyint", {
    name: "is_recom",
    nullable: true,
    comment: "推荐（0=否，1=是）",
    unsigned: true,
    default: () => "'0'",
  })
  isRecom: number | null;

  @Column("tinyint", {
    name: "is_news",
    nullable: true,
    comment: "新品（0=否，1=是）",
    unsigned: true,
    default: () => "'0'",
  })
  isNews: number | null;

  @Column("int", {
    name: "view_count",
    comment: "浏览量",
    unsigned: true,
    default: () => "'0'",
  })
  viewCount: number;

  @Column("smallint", {
    name: "sort",
    nullable: true,
    comment: "排序",
    unsigned: true,
    default: () => "'100'",
  })
  sort: number | null;

  @Column("varchar", {
    name: "tmpl_path",
    nullable: true,
    comment: "模板",
    length: 100,
  })
  tmplPath: string | null;

  @Column("enum", {
    name: "ifpub",
    comment: "上架",
    enum: ["true", "false"],
    default: () => "'true'",
  })
  ifpub: "true" | "false";

  @Column("varchar", {
    name: "seo_title",
    nullable: true,
    comment: "SEO标题",
    length: 255,
  })
  seoTitle: string | null;

  @Column("mediumtext", {
    name: "seo_description",
    nullable: true,
    comment: "分类描述",
  })
  seoDescription: string | null;

  @Column("varchar", {
    name: "seo_keywords",
    nullable: true,
    comment: "搜索关键词",
    length: 200,
  })
  seoKeywords: string | null;
}
